package org.etom.impl.ui.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.etom.impl.ui.Activator;
import org.etom.impl.ui.common.IconConstants;
import org.etom.impl.ui.common.ResourcesTreeViewer;
import org.etom.impl.ui.views.ViewsMessages;

public class RefreshAction extends Action {

  private ResourcesTreeViewer resTreeViewer;
  
  public RefreshAction(ResourcesTreeViewer resTreeViewer) {
    this.resTreeViewer = resTreeViewer;
    init();
  }

  @Override
  public void run() {
    resTreeViewer.refresh();
  }
  
  /*
   * An utility method which initializes the the delete action.
   */
  private void init() {
    setText(ViewsMessages.Resources_context_Menu_Refresh);
    setImageDescriptor(ImageDescriptor.createFromFile(Activator.class,
        IconConstants.MENU_REFRESH_ICON_PATH));
  }
}

